package com.example.yrdev.ordering_system.Main_Menu;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.LinearLayout;

import com.example.yrdev.ordering_system.Adapter.GridViewAdapter;
import com.example.yrdev.ordering_system.Common.CommonActivity;
import com.example.yrdev.ordering_system.R;
import com.example.yrdev.ordering_system.Report.CommodityFileActivity;
import com.example.yrdev.ordering_system.Report.GeneralReportActivity;
import com.example.yrdev.ordering_system.Report.OtherInfoReportActivity;

import com.example.yrdev.ordering_system.Report.PurchaseCommodityActivity;
import com.example.yrdev.ordering_system.Report.RefundCommodityActivity;
import com.example.yrdev.ordering_system.Report.ReportMemberActivity;
import com.example.yrdev.ordering_system.Utils.GlobalFunction;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * Created by yrdev on 8/18/16.
 */
public class MenuReportActivity extends CommonActivity {
    @InjectView(R.id.option_menu)GridView gridView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        showBackButton();
        setBarTitle(GlobalFunction.getResourceString(this,R.string.report));

        initView();


    }
    public void  initView(){


        setContentView(R.layout.menu_report_layout);
        ButterKnife.inject(this);
        Integer [] images={R.drawable.report_member_detail,R.drawable.report_commodity_file,R.drawable.report_refund_detail,
                R.drawable.report_sale_type,R.drawable.report_total_report};
        String[] titles={GlobalFunction.getResourceString(this,R.string.member_detail),GlobalFunction.getResourceString(this,R.string.good_file)
                ,GlobalFunction.getResourceString(this,R.string.refund_detail),GlobalFunction.getResourceString(this,R.string.purchase_detail)
                ,GlobalFunction.getResourceString(this,R.string.total_report)};


        gridView.setAdapter(new GridViewAdapter(this, images,titles));

        gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

                switch (view.getId()){
                    case R.drawable.report_member_detail:
                      gotoActivity(ReportMemberActivity.class,0);
                        break;

                    case R.drawable.report_commodity_file:
                      gotoActivity(CommodityFileActivity.class,0);
                        break;

                    case R.drawable.report_sale_type:

                        gotoActivity(PurchaseCommodityActivity.class,0);

                        break;

                    case R.drawable.report_total_report:

                    gotoActivity(GeneralReportActivity.class,0);

                        break;

                    case R.drawable.report_refund_detail:

                        gotoActivity(RefundCommodityActivity.class,0);

                        break;

//                    default:
//                        gotoActivityWithObject(OtherInfoReportActivity.class,0,"class",String.valueOf(view.getId()));
//
//                        break;
                }
                activatePushingAnim();
            }
        });
    }
}
